import 'package:efood_multivendor/controller/order_controller.dart';
import 'package:efood_multivendor/data/model/body/place_order_body.dart';

class CheckoutBody {
  int? restaurantId;
  String? longitude;
  String? latitude;
  List<Cart>? cart;
  String? couponCode;
  String? orderType;
  String? paymentMethod;
  String? referredBy;

  CheckoutBody(
      {this.restaurantId,
      this.longitude,
      this.latitude,
      this.cart,
      this.couponCode,
      this.orderType,
      this.paymentMethod,
      this.referredBy});

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['restaurant_id'] = this.restaurantId;
    data['longitude'] = this.longitude;
    data['latitude'] = this.latitude;
    data['coupon_code'] = this.couponCode;
    data['order_type'] = 'delivery';
    data['payment_method'] = PaymentMethod.cash_on_delivery.name;
    data['referred_by'] = this.referredBy;
    if (this.cart != null) {
      data['cart'] = this.cart!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}
